import random

# not
print(f"{1 not in [0,1] = }, {2 not in [0,1] = }")
a = b = [0]
print(f"{a is b = }, {a is not b = }, {not a is b = }")

# ternary operator
valid = random.choice([True, False])
result = "valid" if valid else "invalid"
print(result)

n = eval(input("enter a number: "))
# and
pos_int = isinstance(n, int) and n > 0
assert pos_int == all([isinstance(n, int), n > 0])
print(f"you enter a positive integer: {pos_int}")

# or
rational = isinstance(n, int) or type(n) is float
assert rational == any([isinstance(n, int), type(n) is float])
print(f"you enter a rational number: {rational}")
